const path = require('path');

module.exports = {
	entry: path.resolve(__dirname, "./main.js"),
	output: {
		filename: "build.js",
		path: path.resolve(__dirname, "dist"),
	},
	mode: 'development',
	// source-map 模式不正常
	devtool: 'eval',
	devServer: {
		// 
		static: {
			directory: path.join(__dirname, 'dist'),
		},
	},
	// 解析图片资源路径
	module: {
		rules: [
			{
				test: /\.(png|jpe?g|gif)$/i,
				use: [
					{
						loader: "file-loader",
						options: {
							outputPath: "assets/",
							publicPath: ""
						}
					}
				]
			}
		]
	}
}